<template>
  <div class="viewContain">
    <div style="text-align:right">
      <el-button type="primary" size="mini" @click="handleBack()">返回</el-button>
    </div>
    <el-form size="small" label-width="100px">
      <el-row>
        <el-col :xs="{ span: 24 }" :sm="{ span: 12 }" :md="{ span: 6 }" :xl="{ span: 6 }">
          <el-form-item label="总金额(元):">
            {{ Number(orderDetail.total).toFixed(2) || '暂无数据' }}
          </el-form-item>
        </el-col>
        <el-col :xs="{ span: 24 }" :sm="{ span: 12 }" :md="{ span: 6 }" :xl="{ span: 6 }">
          <el-form-item label="订单编号:">
            {{ orderDetail.orderNum || '暂无数据' }}
          </el-form-item>
        </el-col>
        <el-col :xs="{ span: 24 }" :sm="{ span: 12 }" :md="{ span: 6 }" :xl="{ span: 6 }">
          <el-form-item label="订单状态:">
            {{ orderDetail.statusName || '暂无数据' }}
          </el-form-item>
        </el-col>
        <el-col :xs="{ span: 24 }" :sm="{ span: 12 }" :md="{ span: 6 }" :xl="{ span: 6 }">
          <el-form-item label="账号名:">
            {{ orderDetail.accountName || '暂无数据' }}
          </el-form-item>
        </el-col>
        <el-col :xs="{ span: 24 }" :sm="{ span: 12 }" :md="{ span: 6 }" :xl="{ span: 6 }">
          <el-form-item label="收货电话:">
            {{ orderDetail.consigneePhone || '暂无数据' }}
          </el-form-item>
        </el-col>
        <el-col :xs="{ span: 24 }" :sm="{ span: 12 }" :md="{ span: 6 }" :xl="{ span: 6 }">
          <el-form-item label="下单时间:">
            {{ orderDetail.orderTime || '暂无数据' }}
          </el-form-item>
        </el-col>
        <el-col :xs="{ span: 24 }" :sm="{ span: 12 }" :md="{ span: 6 }" :xl="{ span: 6 }">
          <el-form-item label="物流公司:">
            {{ orderDetail.logisticsName || '暂无数据' }}
          </el-form-item>
        </el-col>
        <el-col :xs="{ span: 24 }" :sm="{ span: 12 }" :md="{ span: 6 }" :xl="{ span: 6 }">
          <el-form-item label="收货日期:">
            {{ orderDetail.consigneeDate || '暂无数据' }}
          </el-form-item>
        </el-col>
        <el-col :xs="{ span: 24 }" :sm="{ span: 12 }" :md="{ span: 6 }" :xl="{ span: 6 }">
          <el-form-item label="收货地址:">
            {{ orderDetail.consigneeAddr || '暂无数据' }}
          </el-form-item>
        </el-col>
        <el-col :xs="{ span: 24 }" :sm="{ span: 12 }" :md="{ span: 6 }" :xl="{ span: 6 }">
          <el-form-item label="快递单号:">
            {{ orderDetail.trackNum || '暂无数据' }}
          </el-form-item>
        </el-col>
        <el-col :xs="{ span: 24 }" :sm="{ span: 12 }" :md="{ span: 6 }" :xl="{ span: 6 }">
          <el-form-item label="发货人姓名:">
            {{ orderDetail.shipper || '暂无数据' }}
          </el-form-item>
        </el-col>
        <el-col :xs="{ span: 24 }" :sm="{ span: 12 }" :md="{ span: 6 }" :xl="{ span: 6 }">
          <el-form-item label="异常时间:">
            {{ orderDetail.exceptionTime || '暂无数据' }}
          </el-form-item>
        </el-col>
        <el-col :xs="{ span: 24 }" :sm="{ span: 12 }" :md="{ span: 6 }" :xl="{ span: 6 }">
          <el-form-item label="收货人姓名:">
            {{ orderDetail.consigneeName || '暂无数据' }}
          </el-form-item>
        </el-col>
        <el-col :xs="{ span: 24 }" :sm="{ span: 12 }" :md="{ span: 6 }" :xl="{ span: 6 }">
          <el-form-item label="发货日期:">
            {{ orderDetail.shipDate || '暂无数据' }}
          </el-form-item>
        </el-col>
        <el-col :xs="{ span: 24 }" :sm="{ span: 12 }" :md="{ span: 6 }" :xl="{ span: 6 }">
          <el-form-item label="异常原因:">
            {{ orderDetail.exceptionCauseName || '暂无数据' }}
          </el-form-item>
        </el-col>
        <el-col :xs="{ span: 24 }" :sm="{ span: 12 }" :md="{ span: 6 }" :xl="{ span: 6 }">
          <el-form-item label="支付渠道:">
            {{ orderDetail.payChannel || '暂无数据' }}
          </el-form-item>
        </el-col>
        <el-col :xs="{ span: 24 }" :sm="{ span: 12 }" :md="{ span: 6 }" :xl="{ span: 6 }">
          <el-form-item label="支付流水号:">
            {{ orderDetail.serialNumber || '暂无数据' }}
          </el-form-item>
        </el-col>
        <el-col :xs="{ span: 24 }" :sm="{ span: 12 }" :md="{ span: 6 }" :xl="{ span: 6 }">
          <el-form-item label="会员名:">
            {{ orderDetail.vipName || '暂无数据' }}
          </el-form-item>
        </el-col>
        <el-col :xs="{ span: 24 }" :sm="{ span: 12 }" :md="{ span: 6 }" :xl="{ span: 6 }">
          <el-form-item label="会员号:">
            {{ orderDetail.vipNum || '暂无数据' }}
          </el-form-item>
        </el-col>
      </el-row>
    </el-form>
    <el-table
      ref="table"
      v-loading="loading"
      fit
      stripe
      :data="tableData"
      border
      size="mini"
    >
      <el-table-column align="center" label="序号" type="index" width="50">
        <template slot-scope="scope">
          <span>{{ (listQuery.pageNo - 1) * listQuery.pageSize + scope.$index + 1 }}</span>
        </template>
      </el-table-column>
      <el-table-column prop="productPic" align="center" label="商品图片" width="150">
        <template slot-scope="scope">
          <img :src="scope.row.productPic" width="40" height="40" alt="">
        </template>
      </el-table-column>
      <el-table-column prop="productName" align="center" label="商品名称" width="150" />
      <el-table-column prop="productCode" align="center" label="商品编号" />
      <el-table-column prop="productPrice" align="center" label="商品单价(元)">
        <template slot-scope="scope">
          {{ Number(scope.row.productPrice).toFixed(2) }}
        </template>
      </el-table-column>
      <el-table-column prop="productNum" align="center" label="商品数量" />
    </el-table>
  </div>
</template>

<script>
import { commonMixin } from '@v/mixin/commonMixin.js'
import ComApiUrl from '@a/comomApi.js'
import { getOrderDetail } from '@a/business/order.js'

export default {
  mixins: [commonMixin],
  data() {
    return {
      comApiUrlList: new ComApiUrl(''),
      orderDetail: {},
      id: '', // 路由id
      tableData: [] // 商品table列表
    }
  },
  mounted() {
    this.getList()
  },
  methods: {
    getList() {
      this.id = this.$route.params.id
      getOrderDetail(this.id).then(res => {
        if (res.code === 0) {
          this.orderDetail = res.data
          this.tableData = res.data.orderItemList
        }
      })
    }
  }
}
</script>

<style lang="scss" scoped>

</style>
